package cate.game.play.buff.h;

import cate.common.table.d.GDSkill;
import cate.game.play.buff.BuffHandler;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.proce.action.ctx.TimeActionCtx;
import cate.game.play.proce.move.MoveCtx;

/**
 * 使用技能(普攻不触发)时，受到基于发起者攻击力30%的伤害，并【沉默】自身2回合
 */
public class 封穴BH extends BuffHandler {

	private double 伤害;

	private int 沉默buff;

	//伤害=3000&沉默buff=？？
	@Override
	public void parse(String code) {
		PlayCfgArgs args =new PlayCfgArgs(code);
		伤害 = args.getWDouble("伤害", 0d);
		沉默buff = args.getInt("沉默buff", 0);
	}

	@Override
	public void parseExt(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		伤害 += args.getWDouble("伤害", 0d);
	}

	@Override
	public void onOwnerMoveDone(MoveCtx move, TimeActionCtx action) {
		if (move.getSkill().cfg.row.type == GDSkill.Type.ACTIVE) {
			buff.owner.attr.buffHurt(action, buff.caster, buff.caster.attr.attTotal() * 伤害);
			buff.owner.buff.tryAddByTid(action, buff.caster, 沉默buff);
		}
	}
}
